package com.drawingtimer.admin.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.drawingtimer.admin.converter.TTimeSegmentPauseConverter;
import com.drawingtimer.admin.model.entity.TTimeSegmentPause;
import com.drawingtimer.admin.model.qo.TTimeSegmentPauseQO;
import com.drawingtimer.admin.model.vo.TTimeSegmentPausePageVO;
import com.hccake.ballcat.common.model.domain.PageParam;
import com.hccake.ballcat.common.model.domain.PageResult;
import com.hccake.extend.mybatis.plus.conditions.query.LambdaQueryWrapperX;
import com.hccake.extend.mybatis.plus.mapper.ExtendMapper;
import com.hccake.extend.mybatis.plus.toolkit.WrappersX;

/**
 * 时间段暂停记录
 *
 * @author ballcat 2025-04-30 14:13:33
 */
public interface TTimeSegmentPauseMapper extends ExtendMapper<TTimeSegmentPause> {

	/**
	 * 分页查询
	 * @param pageParam 分页参数
	 * @param qo 查询参数
	 * @return PageResult<TTimeSegmentPausePageVO> VO分页数据
	 */
	default PageResult<TTimeSegmentPausePageVO> queryPage(PageParam pageParam, TTimeSegmentPauseQO qo) {
		IPage<TTimeSegmentPause> page = this.prodPage(pageParam);
		LambdaQueryWrapperX<TTimeSegmentPause> wrapper = WrappersX.lambdaQueryX(TTimeSegmentPause.class);
		this.selectPage(page, wrapper);
		IPage<TTimeSegmentPausePageVO> voPage = page.convert(TTimeSegmentPauseConverter.INSTANCE::poToPageVo);
		return new PageResult<>(voPage.getRecords(), voPage.getTotal());
	}

}